﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace PrimeNumbersApp
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                // main thread started
                Console.WriteLine("Validation started\n");

                // creating a new thread delegate
                ThreadStart ts = new ThreadStart(() => PrimeNumbers.First20());

                // creating a new foreground thread
                Thread t1 = new Thread(ts);

                t1.Start(); // starting the thread
                t1.Join(); // join with main thread when finished

                // main thread running again
                Console.WriteLine("\nValidation completed\n");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}
